package com.linewow.xhyy.hrxb;


import com.squareup.okhttp.OkHttpClient;

import retrofit.CallAdapter;
import retrofit.GsonConverterFactory;
import retrofit.Retrofit;
import retrofit.RxJavaCallAdapterFactory;

/**
 * Created by LXR on 2016/9/27.
 */
public class NiHaoNetWork {
    private static NihaoService nihaoService;
    private static OkHttpClient okHttpClient=new OkHttpClient();
    private static GsonConverterFactory factory=GsonConverterFactory.create();
    private static CallAdapter.Factory callAdapterFactory= RxJavaCallAdapterFactory.create();
    public static NihaoService getNihaoService(){
        if(nihaoService==null){

            Retrofit retrofit=new Retrofit.Builder()
                    .client(okHttpClient)
                    .baseUrl("https://m.en1on1.com/")
                    .addConverterFactory(factory)
                    .addCallAdapterFactory(callAdapterFactory)
                    .build();

            nihaoService=retrofit.create(NihaoService.class);

        }
        return  nihaoService;
    }
}
